package
{
	import flash.events.EventDispatcher;
	
	import formsEncuesta.modulo9.UsoProgramas;
	
	import vo.Empresa;
	import vo.Usuario;

	public class AppConfig extends EventDispatcher{
		/**EVENTS DECLARATION*/
		public static var LOGIN_SUCCESSFUL:String		=	"LOGIN_SUCCESSFUL";
		public static var LOGOUT_SUCCESSFUL:String	=	"LOGOUT_SUCCESSFUL";
		public static var NEWS_CHANGE:String			=	"NEWS_CHANGE";
		
		private static var _instance:AppConfig = null;
		private static var _empresa:Empresa;
		private static var _usuario:Usuario = null;
		private static var _loggedIn:Boolean = false;
		private var _gatewayUrl:String;
		
		public function AppConfig(){
		}
		
		public static function getInstance():AppConfig{
			if(_instance == null){
				_instance = new AppConfig();
			}
			return _instance;
		}
		
		public function getGatewayUrl():String{
			return this._gatewayUrl;
		}
		
		public function loadConfig(xmlFile:Object):void{
			this._gatewayUrl = xmlFile.GatewayUrl.toString();
		}
		
		public static function get empresa():Empresa{
			return _empresa;
		}
		
		public static function set empresa(emp:Empresa):void{
			_empresa = emp;
		}
		
		public static function get usuario():Usuario{
			return _usuario;
		}
		
		public static function set usuario(usr:Usuario):void{
			_usuario = usr;
		}
		
		public static function get loggedIn():Boolean{
			return _loggedIn;
		}
		
		public static function set loggedIn(logged:Boolean):void{
			_loggedIn = logged;
		}
	}
}